<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of add_obc_nodes_list</title>
  <meta name="keywords" content="add_obc_nodes_list">
  <meta name="description" content="Add a set of obc nodes comprising a single obc boundary to Mesh structure">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">fvcom_prepro</a> &gt; add_obc_nodes_list.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_prepro&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>add_obc_nodes_list
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Add a set of obc nodes comprising a single obc boundary to Mesh structure</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [Mobj]  = add_obc_nodes_list(Mobj,Nlist,ObcName,ObcType) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Add a set of obc nodes comprising a single obc boundary to Mesh structure  
 Using a list of nodes

 [Mobj] = add_obc_nodes(Mobj)

 DESCRIPTION:
    Select using ginput the set of nodes comprising an obc

 INPUT
    Mobj = Matlab mesh object
    Nlist = List of nodes
    ObcName = Name of the Open Boundary
    ObcType = FVCOM Flag for OBC Type

 OUTPUT:
    Mobj = Matlab mesh object with an additional obc nodelist

 EXAMPLE USAGE
    Mobj = add_obc_nodes_list(Mobj,Nlist,'OpenOcean')

 Author(s):  
    Geoff Cowles (University of Massachusetts Dartmouth)

 Note:
    Uses ginput2 which allows zoom/pan before selecting points and displays
    clicked points realtime

 Revision history
   
==============================================================================</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="example.html" class="code" title="">example</a>	example demonstrating reading in a 2DM file and constructing a model</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [Mobj]  = add_obc_nodes_list(Mobj,Nlist,ObcName,ObcType) </a>
0002 
0003 <span class="comment">% Add a set of obc nodes comprising a single obc boundary to Mesh structure</span>
0004 <span class="comment">% Using a list of nodes</span>
0005 <span class="comment">%</span>
0006 <span class="comment">% [Mobj] = add_obc_nodes(Mobj)</span>
0007 <span class="comment">%</span>
0008 <span class="comment">% DESCRIPTION:</span>
0009 <span class="comment">%    Select using ginput the set of nodes comprising an obc</span>
0010 <span class="comment">%</span>
0011 <span class="comment">% INPUT</span>
0012 <span class="comment">%    Mobj = Matlab mesh object</span>
0013 <span class="comment">%    Nlist = List of nodes</span>
0014 <span class="comment">%    ObcName = Name of the Open Boundary</span>
0015 <span class="comment">%    ObcType = FVCOM Flag for OBC Type</span>
0016 <span class="comment">%</span>
0017 <span class="comment">% OUTPUT:</span>
0018 <span class="comment">%    Mobj = Matlab mesh object with an additional obc nodelist</span>
0019 <span class="comment">%</span>
0020 <span class="comment">% EXAMPLE USAGE</span>
0021 <span class="comment">%    Mobj = add_obc_nodes_list(Mobj,Nlist,'OpenOcean')</span>
0022 <span class="comment">%</span>
0023 <span class="comment">% Author(s):</span>
0024 <span class="comment">%    Geoff Cowles (University of Massachusetts Dartmouth)</span>
0025 <span class="comment">%</span>
0026 <span class="comment">% Note:</span>
0027 <span class="comment">%    Uses ginput2 which allows zoom/pan before selecting points and displays</span>
0028 <span class="comment">%    clicked points realtime</span>
0029 <span class="comment">%</span>
0030 <span class="comment">% Revision history</span>
0031 <span class="comment">%</span>
0032 <span class="comment">%==============================================================================</span>
0033 subname = <span class="string">'add_obc_nodes'</span>;
0034 <span class="keyword">global</span> ftbverbose
0035 <span class="keyword">if</span>(ftbverbose)
0036   fprintf(<span class="string">'\n'</span>)
0037   fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>])
0038 <span class="keyword">end</span>;
0039 
0040 
0041 <span class="comment">%------------------------------------------------------------------------------</span>
0042 <span class="comment">% Get a unique list and make sure they are in the range of node numbers</span>
0043 <span class="comment">%------------------------------------------------------------------------------</span>
0044 Nlist = unique(Nlist);
0045 
0046 <span class="keyword">if</span>(max(Nlist) &gt; Mobj.nVerts);
0047   fprintf(<span class="string">'your open boundary node number exceed the total number of nodes in the domain\n'</span>);
0048   error(<span class="string">'stopping...\n'</span>)
0049 <span class="keyword">end</span>;
0050 
0051 <span class="comment">%------------------------------------------------------------------------------</span>
0052 <span class="comment">% Plot the mesh</span>
0053 <span class="comment">%------------------------------------------------------------------------------</span>
0054 
0055 <span class="keyword">if</span>(lower(Mobj.nativeCoords(1:3)) == <span class="string">'car'</span>)
0056     x = Mobj.x;
0057     y = Mobj.y;
0058 <span class="keyword">else</span>
0059     x = Mobj.lon;
0060     y = Mobj.lat;
0061 <span class="keyword">end</span>;
0062 
0063 figure
0064 patch(<span class="string">'Vertices'</span>,[x,y],<span class="string">'Faces'</span>,Mobj.tri,<span class="keyword">...</span>
0065         <span class="string">'Cdata'</span>,Mobj.h,<span class="string">'edgecolor'</span>,<span class="string">'k'</span>,<span class="string">'facecolor'</span>,<span class="string">'interp'</span>);
0066 hold on;
0067 
0068 plot(x(Nlist),y(Nlist),<span class="string">'ro'</span>);
0069 title(<span class="string">'open boundary nodes'</span>);
0070 
0071 <span class="comment">% add to mesh object</span>
0072 npts = numel(Nlist);
0073 Mobj.nObs = Mobj.nObs + 1;
0074 Mobj.nObcNodes(Mobj.nObs) = npts; 
0075 Mobj.obc_nodes(Mobj.nObs,1:npts) = Nlist;
0076 Mobj.obc_name{Mobj.nObs} = ObcName;
0077 Mobj.obc_type(Mobj.nObs) = ObcType;
0078 
0079 
0080 <span class="keyword">if</span>(ftbverbose)
0081   fprintf([<span class="string">'end   : '</span> subname <span class="string">'\n'</span>])
0082 <span class="keyword">end</span>;
0083</pre></div>
<hr><address>Generated on Wed 02-Nov-2011 21:58:00 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>